﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace ALMDDD.Infrastructure.migrations.ALMContextMigrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "sys_role",
                columns: table => new
                {
                    id = table.Column<Guid>(nullable: false),
                    trxUser = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxName = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    roleName = table.Column<string>(type: "varchar(50)", nullable: true),
                    roleCode = table.Column<string>(type: "varchar(20)", nullable: true),
                    roleType = table.Column<string>(type: "varchar(20)", nullable: true),
                    context = table.Column<string>(type: "nvarchar(200)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_role", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "sys_user",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    trxUser = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxName = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    UserId = table.Column<string>(type: "varchar(30)", nullable: false),
                    UserName = table.Column<string>(nullable: true),
                    Gender = table.Column<string>(type: "char(1)", nullable: false),
                    PassWord = table.Column<string>(type: "varchar(30)", nullable: false),
                    Email = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true),
                    Phone = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_user", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "sys_user_role",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    trxUser = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxName = table.Column<string>(type: "varchar(20)", nullable: true),
                    trxTime = table.Column<DateTime>(type: "datetime", nullable: false),
                    roleId = table.Column<Guid>(nullable: false),
                    userId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_user_role", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "sys_role");

            migrationBuilder.DropTable(
                name: "sys_user");

            migrationBuilder.DropTable(
                name: "sys_user_role");
        }
    }
}
